package com.zjcode.cas.job;

import com.alibaba.fastjson.JSONObject;
import com.zjcode.cas.model.PreUsers;
import com.zjcode.cas.service.CasSyncService;
import com.zjcode.cas.service.CerCasUsersyncinfoService;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @ClassName:MyJob
 * @功能：
 * @author：wlei
 * @日期：2023/2/6-22:15
 **/
@Configuration
@EnableScheduling
@Slf4j
public class MyJob {

    @Autowired
    private CerCasUsersyncinfoService cerCasUsersyncinfoService;

    ///**
    // * 系统健康检测
    // */
    //@Scheduled(cron = "0 0/1 * * * ? ")
    //public void execHeathCheck() {
    //    log.info("execHeathCheck" + LocalDateTime.now());
    //}

    /**
     * 每天凌晨1点执行
     */
    //@Scheduled(cron = "0 0 1 * * ? ")
    @Scheduled(cron = "0 0/5 * * * ? ")
    public void execEveryDay4UserSync() {
        log.info("execEveryDay4UserSync" + LocalDateTime.now());
        int i = cerCasUsersyncinfoService.syncUserFormCas();
        log.info(
            "execEveryDay4UserSync" + LocalDateTime.now() + "同步用户数据到临时表中" + i + "条");

    }
}
